<template>
	<view>
		<department-list @categorySubClick="categorySubClick"></department-list>
	</view>
</template>

<script>
	import requestV2 from '@/utils/request'
	import departmentList from '@/components/department-list.vue';
	import {
		typeList
	} from "@/utils/Constant";

	export default {
		data() {
			return {}
		},
		onLoad() {
			this.getTipsContent()
		},
		components: {
			departmentList
		},
		methods: {
			async getTipsContent() {
				let payload = {
					service: 'smarthos.system.param.key',
					key: 'FAMILY_PLAN_CLINIC_REMIND_MSG'
				}
				let res = await requestV2.post(payload)
				console.log("restip==>", res);
				if (res.code == '0' && res.obj.paramValue) {
					_this.tips = res.obj.paramValue
				}
			},
			categorySubClick(category) {
				console.log(`======category====111===>`, category)
				this.navId = category.type
				let url=`/PagesRegV2/appointment/appointment?deptId=${category.deptId}&type=${category.type}`
				let _this = this
				if (category.deptName === '计划生育门诊' && _this.tips != '') {
					uni.showModal({
						title: '提示',
						content: _this.tips,
						cancelText: "取消", // 取消按钮的文字
						confirmText: "确认", // 确认按钮的文字
						success: (res) => {
							if (res.confirm) {
								console.log('comfirm') //点击确定之后执行的代码
								uni.navigateTo({url});
							} else {
								console.log('cancel') //点击取消之后执行的代码
							}
						}
					})
				} else {
					uni.navigateTo({url});
				}
			},
		}
	}
</script>

<style scoped>
	html,
	page {
		width: 100%;
		height: 100%;
	}

	.box {
		width: 100%;
		height: 100%;
		display: flex;
		flex-direction: column;
	}
</style>